package sg.edu.nus.iss.vmcs.service;

import sg.edu.nus.iss.vmcs.system.SimulatorControlPanel;

public class SimulationControlDisplayService implements ISimulationControlDisplayService {
	
	private SimulatorControlPanel simulatorControlPanel;
	private static SimulationControlDisplayService instance;
	
	/**
	 * Return new maintainance Panel display service
	 * @return
	 */
	public static SimulationControlDisplayService getInstance(){
		
		if(instance==null){
			instance = new SimulationControlDisplayService();
		}
	
		return instance;
	}
	/**
	 * Get the simulation control panel
	 * @return
	 */
	public SimulatorControlPanel getSimulatorControlPanel() {
		return simulatorControlPanel;
	}
	/**
	 * Set the simulation control panel
	 * @param simulatorControlPanel
	 */
	public void setSimulatorControlPanel(SimulatorControlPanel simulatorControlPanel) {
		this.simulatorControlPanel = simulatorControlPanel;
	}
	/**
	 * Display the simulation control panel
	 */
	public void displaySimulationControlPanel(){
		simulatorControlPanel.display();
	}
	/**
	 * Close down the simulation control panel
	 */
	public void closeDownSimualtionControlPanel(){
		simulatorControlPanel.closeDown();
	}
	/**
	 * Start the control panel
	 */
	public void startSimulationPanel(){
		simulatorControlPanel.setSimulationActive(true);
		simulatorControlPanel.setActive(SimulatorControlPanel.SIMUL_BEGIN, false);
	}
	/**
	 * Set the status of the simulation button
	 * @param isOn
	 */
	public void setSimulationActive(boolean isOn){
		simulatorControlPanel.setSimulationActive(isOn);
	}
	/**
	 * Set the state of the simulation control panel
	 * @param id
	 * @param state
	 */
	public void setActivePanel (int id, boolean state){
		simulatorControlPanel.setActive(id, state);
	}
}
